package cn.boy.dao;

import java.io.InputStream;
import java.util.Properties;


public class AdminstratorDaoFactory {
	
	private AdminstratorDao dao;
	private static AdminstratorDaoFactory instance = new AdminstratorDaoFactory();

	private AdminstratorDaoFactory() {

		try {
			Properties prop = new Properties();
			InputStream is = AdminstratorDaoFactory.class.getClassLoader()
					.getResourceAsStream("config.properties");
			prop.load(is);
			String adminstratorDaoClass = prop.getProperty("adminstratorDaoClass");
			Class clazz = Class.forName(adminstratorDaoClass);
			dao = (AdminstratorDao) clazz.newInstance();
		} catch (Exception e) {
			e.printStackTrace();
			throw new ExceptionInInitializerError(e);
		}

	}

	public static AdminstratorDaoFactory getInstance() {
		return instance;
	}

	public AdminstratorDao getAdminstratorDao() {
		return dao;
	}

}
